﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using mtgtoolbox.Models;
using System.ComponentModel;

namespace mtgtoolbox.Controls.CollectionList.ViewModels
{
  public class CollectionListViewModel : ICollectionListViewModel
  {
    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged(string name)
    {
      if (PropertyChanged != null)
        PropertyChanged(this, new PropertyChangedEventArgs(name));
    }

    private String filterText = "";
    public String FilterText
    {
      get { return filterText; }
      set { filterText = value; OnPropertyChanged("FilterText"); }
    }

    private ObservableCollection<CollectionListCardViewModel> cards = new ObservableCollection<CollectionListCardViewModel>();
    public ObservableCollection<CollectionListCardViewModel> Cards
    {
      get { return cards; }
    }

    protected List<String> headings = new List<String>() { "Name", "Set", "Count" };
    public List<String> Headings
    {
      get { return headings; }
    }

    virtual public void LoadCollection(String collectionName)
    {
      Cards.Add(new CollectionListCardViewModel(new Card() { Name = "Wrath of God", Set = "Ninth Edition", Count = 0, FoilCount = 0, SpecialCount = 0 }));
      Cards.Add(new CollectionListCardViewModel(new Card() { Name = "Twiddle", Set = "Tenth Edition", Count = 0, FoilCount = 0, SpecialCount = 0 }));
      Cards.Add(new CollectionListCardViewModel(new Card() { Name = "Capsize", Set = "Fifth Edition", Count = 0, FoilCount = 0, SpecialCount = 0 }));
    }
  }
}
